using System;
using System.Collections.Generic;
using System.Text;

namespace TVDesigner.Generator.Components
{
    public class HIcon : GenericComponent
    {
        private string _Image;

        public string Image
        {
            get { return _Image; }
            set { _Image = value; }
        }

        public override string TypeString
        {
            get { return "org.havi.ui.HStaticIcon"; }
        }
	
        protected override void SetAtributes(StringBuilder sb)
        {
            if (this.Image != null && !this.Image.Equals(string.Empty))
            {
                sb.Append("\t\t\tjava.awt.Image image = ImagesController.getInstance().getImage(\"").Append(this.Image).Append("\");\n");
                sb.Append("\t\t\tif (image != null) {\n");
                sb.Append("\t\t\t\t").Append(NameStartedWithLowerCase).Append(".setGraphicContent(image, org.havi.ui.HVisible.NORMAL_STATE);\n");
                sb.Append("\t\t\t\tint width = image.getWidth(null);\n");
                sb.Append("\t\t\t\tint height = image.getHeight(null);\n");
                sb.Append("\t\t\t\t").Append(NameStartedWithLowerCase).Append(".setSize(width, height);\n");
                sb.Append("\t\t\t}\n");                
            }
        }
    }
}
